﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace XDesigner.AppFramework.Test
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }
         
        private void ShowChildForm(Type frmType)
        {
            foreach (Form frm in this.MdiChildren)
            {
                if (frm.GetType().Equals(frmType))
                {
                    frm.Activate();
                    return;
                }
            }
            Form newForm = (Form)System.Activator.CreateInstance(frmType);
            newForm.MdiParent = this;
            newForm.Show();
            newForm.WindowState = FormWindowState.Maximized;
        }

        private void btnUserDefine_Click(object sender, EventArgs e)
        {
            ShowChildForm(typeof(frmUserDefine));
        }
         
    }
}